-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate torchscript frontend #3373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to C++ style guidelines:
diff --git a/home/runner/work/TensorRT/TensorRT/cpp/include/torch_tensorrt/ptq.h b/tmp/changes.txt
index 50f63f8..3a05b3b 100644
--- a/home/runner/work/TensorRT/TensorRT/cpp/include/torch_tensorrt/ptq.h
+++ b/tmp/changes.txt
@@ -59,7 +59,7 @@ class Int8Calibrator : Algorithm {
* calibration cache
* @param use_cache : bool - Whether to use the cache (if it exists)
*/
- Int8Calibrator(DataLoaderUniquePtr dataloader, const std::string& cache_file_path, bool use_cache)
+ Int8Calibrator(DataLoaderUniquePtr dataloader, const std::string& cache_file_path, bool use_cache)
: dataloader_(dataloader.get()), cache_file_path_(cache_file_path), use_cache_(use_cache) {
for (auto batch : *dataloader_) {
batched_data_.push_back(batch.data);
@@ -309,11 +309,10 @@ class Int8CacheCalibrator : Algorithm {
* @return Int8Calibrator<Algorithm, DataLoader>
*/
template <typename Algorithm = nvinfer1::IInt8EntropyCalibrator2, typename DataLoader>
-[[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]]
-inline Int8Calibrator<Algorithm, DataLoader> make_int8_calibrator(
- DataLoader dataloader,
- const std::string& cache_file_path,
- bool use_cache) {
+[[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]] inline Int8Calibrator<
+ Algorithm,
+ DataLoader>
+make_int8_calibrator(DataLoader dataloader, const std::string& cache_file_path, bool use_cache) {
return Int8Calibrator<Algorithm, DataLoader>(std::move(dataloader), cache_file_path, use_cache);
}
@@ -344,8 +343,9 @@ inline Int8Calibrator<Algorithm, DataLoader> make_int8_calibrator(
* @return Int8CacheCalibrator<Algorithm>
*/
template <typename Algorithm = nvinfer1::IInt8EntropyCalibrator2>
-[[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]]
-inline Int8CacheCalibrator<Algorithm> make_int8_cache_calibrator(const std::string& cache_file_path) {
+[[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]] inline Int8CacheCalibrator<
+ Algorithm>
+make_int8_cache_calibrator(const std::string& cache_file_path) {
return Int8CacheCalibrator<Algorithm>(cache_file_path);
}
ERROR: Some files do not conform to style guidelines
e447364
to
d707352
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to C++ style guidelines:
diff --git a/home/runner/work/TensorRT/TensorRT/cpp/include/torch_tensorrt/ptq.h b/tmp/changes.txt
index ae8aa07..a2f8234 100644
--- a/home/runner/work/TensorRT/TensorRT/cpp/include/torch_tensorrt/ptq.h
+++ b/tmp/changes.txt
@@ -59,7 +59,7 @@ class Int8Calibrator : Algorithm {
* calibration cache
* @param use_cache : bool - Whether to use the cache (if it exists)
*/
- Int8Calibrator(DataLoaderUniquePtr dataloader, const std::string& cache_file_path, bool use_cache)
+ Int8Calibrator(DataLoaderUniquePtr dataloader, const std::string& cache_file_path, bool use_cache)
: dataloader_(dataloader.get()), cache_file_path_(cache_file_path), use_cache_(use_cache) {
for (auto batch : *dataloader_) {
batched_data_.push_back(batch.data);
@@ -343,7 +343,8 @@ TORCH_TENSORRT_PTQ_DEPRECATION inline Int8Calibrator<Algorithm, DataLoader> make
* @return Int8CacheCalibrator<Algorithm>
*/
template <typename Algorithm = nvinfer1::IInt8EntropyCalibrator2>
-TORCH_TENSORRT_PTQ_DEPRECATION inline Int8CacheCalibrator<Algorithm> make_int8_cache_calibrator(const std::string& cache_file_path) {
+TORCH_TENSORRT_PTQ_DEPRECATION inline Int8CacheCalibrator<Algorithm> make_int8_cache_calibrator(
+ const std::string& cache_file_path) {
return Int8CacheCalibrator<Algorithm>(cache_file_path);
}
diff --git a/home/runner/work/TensorRT/TensorRT/cpp/include/torch_tensorrt/macros.h b/tmp/changes.txt
index 5fce518..bdc25f6 100644
--- a/home/runner/work/TensorRT/TensorRT/cpp/include/torch_tensorrt/macros.h
+++ b/tmp/changes.txt
@@ -30,7 +30,9 @@
STR(TORCH_TENSORRT_MAJOR_VERSION) \
"." STR(TORCH_TENSORRT_MINOR_VERSION) "." STR(TORCH_TENSORRT_PATCH_VERSION)
-#define TORCH_TENSORRT_PTQ_DEPRECATION [[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]]
+#define TORCH_TENSORRT_PTQ_DEPRECATION \
+ [[deprecated( \
+ "Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]]
// Setup namespace aliases for ease of use
namespace torch_tensorrt {
namespace torchscript {}
ERROR: Some files do not conform to style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/ts/_compiler.py 2025-01-31 19:46:47.225172+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/ts/_compiler.py 2025-01-31 19:47:11.147582+00:00
@@ -104,11 +104,11 @@
"""
warnings.warn(
'The torchscript frontend for Torch-TensorRT has been deprecated, please plan on porting to the dynamo frontend (torch_tensorrt.compile(..., ir="dynamo"). Torchscript will continue to be a supported deployment format via post compilation torchscript tracing, see: https://pytorch.org/TensorRT/user_guide/saving_models.html for more details',
DeprecationWarning,
- stacklevel=2
+ stacklevel=2,
)
input_list = list(inputs) if inputs is not None else []
enabled_precisions_set = (
enabled_precisions if enabled_precisions is not None else set()
@@ -248,11 +248,11 @@
bytes: Serialized TensorRT engine, can either be saved to a file or deserialized via TensorRT APIs
"""
warnings.warn(
'The torchscript frontend for Torch-TensorRT has been deprecated, please plan on porting to the dynamo frontend (torch_tensorrt.convert_method_to_trt_engine(..., ir="dynamo"). Torchscript will continue to be a supported deployment format via post compilation torchscript tracing, see: https://pytorch.org/TensorRT/user_guide/saving_models.html for more details',
DeprecationWarning,
- stacklevel=2
+ stacklevel=2,
)
input_list = list(inputs) if inputs is not None else []
enabled_precisions_set = (
enabled_precisions if enabled_precisions is not None else {torch.float}
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/ts/ptq.py 2025-01-31 19:46:47.225172+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/ts/ptq.py 2025-01-31 19:47:11.237116+00:00
@@ -91,11 +91,11 @@
def __new__(cls, *args: Any, **kwargs: Any) -> Self:
warnings.warn(
"Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details",
DeprecationWarning,
- stacklevel=2
+ stacklevel=2,
)
dataloader = args[0]
algo_type = kwargs.get("algo_type", CalibrationAlgo.ENTROPY_CALIBRATION_2)
cache_file = kwargs.get("cache_file", None)
use_cache = kwargs.get("use_cache", False)
@@ -183,11 +183,11 @@
def __new__(cls, *args: Any, **kwargs: Any) -> Self:
warnings.warn(
"Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details",
DeprecationWarning,
- stacklevel=2
+ stacklevel=2,
)
cache_file = args[0]
algo_type = kwargs.get("algo_type", CalibrationAlgo.ENTROPY_CALIBRATION_2)
if os.path.isfile(cache_file):
d707352
to
9918882
Compare
Description
Deprecate the TS frontend, Dynamo can be used in conjunction with TorchScript to get the same deployment feature set + the extra operator support.
Fixes # (issue)
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: